import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'download_page.dart';
import 'full_video_page.dart';
import 'window_video_page.dart';

class VideoPlayerPage  extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _State();
  }

}

enum PlayType {
  network,
  asset,
  file,
  fileId,
}

String networkMp4 = 'http://1252463788.vod2.myqcloud.com/95576ef5vodtransgzp1252463788/e1ab85305285890781763144364/v.f10.mp4';
String liveUrl1 = 'http://5815.liveplay.myqcloud.com/live/5815_89aad37e06ff11e892905cb9018cf0d4.flv';
String liveUrl2 = 'rtmp://58.200.131.2:1935/livetv/hunantv';
String assetPath = 'static/tencent1.mp4';

class _State extends State<VideoPlayerPage>{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(title: Text('腾讯播放器Demo'),),
      body: ListView(
        children: <Widget>[
          ListTile(
            title: Text('小窗视频'),
            onTap: () {
              Navigator.of(context).push(CupertinoPageRoute(builder: (_) => WindowVideoPage(playType: PlayType.network, dataSource: networkMp4,)));
            },
          ),
          ListTile(
            title: Text('网络视频'),
            onTap: () {
              Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.network, dataSource: networkMp4,)));
            },
          ),
          ListTile(
            title: Text('直播1'),
            onTap: () {
              Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.network, dataSource: liveUrl1, showBottomWidget: false, showClearBtn: false,)));
            },
          ),
          ListTile(
            title: Text('直播2'),
            onTap: () {
              Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.network, dataSource: liveUrl2, showBottomWidget: false, showClearBtn: false,)));
            },
          ),
          ListTile(
            title: Text('asset视频'),
            onTap: () {
              Navigator.of(context).push(CupertinoPageRoute(builder: (_) => FullVideoPage(playType: PlayType.asset, dataSource: assetPath,)));
            },
          ),
          ListTile(
            title: Text('下载播放视频'),
            onTap: () {
              Navigator.of(context).push(CupertinoPageRoute(builder: (_) => DownloadPage()));
            },
          ),
        ],
      ),
    );
  }
}
